<template>
	<view class="beijingse">
		<!-- 提现弹出层 -->
		<u-popup :show="show" :round="10" mode="center" @close="close">
			<view class="tanchuceng">
				<view class="tixianicon"></view>
				<view class="textcenter notitletext margin_top2">提现申请发起成功，正在处理中！</view>
				<view class="flexcenter">
					<view class="querenbtn margin_top5" @click="close">确认</view>
				</view>
			</view>
		</u-popup>
		<header-top :messageInfo="{typeFlag:true,message:'提现',liner:false}"></header-top>
		<view class="block1">
			<view class="baisetext">可提现金额 (元)</view>
			<view class="baisetext1 margin_top">{{qian}}</view>
		</view>
		<view class="neirong mainpadding">
			<view class="radius ffffff mainpadding shadow">
				<view class="strongtext">提现金额 (元)</view>
				<view class="flexbetween margin_top">
					<view class="flexleft">
						<view class="vbigtext">￥</view>
						<input type="text" v-model="tx_num">
					</view>
					<view class="chengsetext" @click="alltx">全部提现</view>
				</view>
			</view>
			<view class="margin_top2 ffffff radius shadow mainpadding">
				<view class="flexbetween">
					<view class="nostrongtext">提现至</view>
					<view class="flexright" @click="tzxgzfb">
						<view class="zhifubao margin_right1"></view>
						<view class="nostrongtext margin_right1">支付宝</view>
						<view class="huiyoujt"></view>
					</view>
				</view>
			</view>
			<view class="bigbtn margin_top6" @click="txneirong">提现</view>
			<view class="textcenter bigcstext margin_top" @click="tztxjl">提现记录</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				show: false,
				qian:"",
				tx_num:"",
			}
		},
		onShow() {
			this.userinfor()
		},
		methods: {
			// 全部提现
			alltx(){
				this.tx_num = this.qian
			},
			// 用户信息
			userinfor() {
				httpRequest.request('api/user/index', 'POST', {
					// 传参
				}, false, false, true).then(res => {
					if (res.code == 1) {
						this.qian =  res.data.money_text.toFixed(2)
					}
				})
			},
			// 跳转提现记录页面
			tztxjl(){
				uni.navigateTo({
					url: '/pages/mypage/tixianjil'
				})
			},
			// 跳转修改支付宝页面
			tzxgzfb() {
				uni.navigateTo({
					url: '/pages/mypage/xiugaizfb'
				})
			},
			// 支付宝提现，直接调用接口即可。
			txneirong() {
				httpRequest.request('api/user/addWithdrawal', 'POST', {
					type:2,
					price:this.tx_num
				}, false, false, true).then(res => {
					if (res.code == 1) {
						this.show = true
					}else{
						httpRequest.toast(res.msg)
					}
				})
			},
			close() {
				this.show = false
				// console.log('close');
			}
		}
	}
</script>

<style lang="scss" scoped>
	.querenbtn {
		border-radius: 40rpx;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		width: 328rpx;
		height: 64rpx;
		background-size: 100% 100%;
		display: flex;
		background-color:#FD463E;
		align-items: center;
		justify-content: center;
	}

	.tixianicon {
		height: 198rpx;
		width: 203rpx;
		background-size: 100% 100%;
		margin: auto;
		width: 236rpx;
		background-image: url('../../static/image/system/tixianicon.png');
	}

	.tanchuceng {
		padding: 40rpx 70rpx;
	}

	.neirong {
		position: relative;
		top: -170rpx;
	}

	.bigcstext {
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FD463E;
	}

	.chengsetext {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FD463E;
	}

	.vbigtext {
		font-size: 40rpx;
		font-family: DIN Next LT Pro-Regular, DIN Next LT Pro;
		font-weight: 400;
		color: #333333;
	}

	.baisetext1 {
		font-size: 40rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #FFFFFF;
	}

	.baisetext {
		font-size: 24rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #FFFFFF;
	}

	.block1 {
		padding: 30rpx 30rpx 0;
		width: 100%;
		min-height: 278rpx;
		background-size: 100% 100%;
		background-image: url('../../static/image/system/tixianbjt.png');
	}
</style>
